#导入基类
from gaoyi.base import Base
#导入By方法
from selenium.webdriver.common.by import By
#强制等待
from time import sleep

#封装基类
class SouSuoPage(Base):

    #定义搜索框
    sousuokuang = (By.ID,'cn.xuexi.android:id/img_search_left')
    #定义输入框
    shurukuang = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.SearchView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.EditText')


    #断言
    dy = (By.XPATH,'//android.view.View[@text="全部"]')


    def sousuoyeuw(self,c):
        #定义搜索框，并点击
        self.find_ele(self.shurukuang).click()
        sleep(2)
        # 定义输入框，并点击
        self.find_ele(self.shurukuang).send_keys(c)
        sleep(2)



    #定义搜索框
    sousuokuang = (By.XPATH,'//android.widget.ImageView[@resource-id="cn.xuexi.android:id/img_search_left"]')
    #定义输入框
    shurukuang = 'new UiSelector().text("二十大报告")'

    #定义断言
    dy2 = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/com.uc.webview.export.WebView/android.webkit.WebView')
    dy3= 'new UiSelector().resourceId("cn.xuexi.android:id/titleHead")'


    def sousuoddtyewu(self,c):
        #定义搜索框，并点击
        self.find_ele(self.sousuokuang).click()
        sleep(2)
        #定义输入框，并点击
        self.find_ele(self.shurukuang).send_keys(c)
        sleep(2)

    #定义搜索框元素
    sousuokuang = (By.XPATH,'//android.widget.ImageView[@resource-id="cn.xuexi.android:id/img_search_left"]')
    #定义二十大报告元素
    ershida = 'new UiSelector().text("二十大报告")'
    #定义视频元素
    shipin = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/com.uc.webview.export.WebView/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View[1]/android.widget.TabWidget/android.view.View[2]')


    #断言
    dy = 'new UiSelector().text("音频")'


    def sousuo1yewu(self):
        self.find_ele(self.sousuokuang).click()
        sleep(2)
        self.find_ele(self.ershida).click()
        sleep(2)
        self.find_ele(self.shipin).click()
        sleep(2)



